interface Creep{
    /* 便捷函数 */
    workstate(rType:ResourceConstant):void
    farsourceID():void
    gainStoreStructure(sType:STRUCTURE_CONTAINER|STRUCTURE_STORAGE|STRUCTURE_LINK|STRUCTURE_TERMINAL,rType:ResourceConstant):StructureStorage|StructureContainer|StructureTerminal|StructureLink | undefined
    /* 行为基本函数 */
    move_(direction: DirectionConstant): CreepMoveReturnCode | ERR_INVALID_TARGET
    requireCross(direction:DirectionConstant):boolean
    matualCross(direction: DirectionConstant):OK | ERR_BUSY | ERR_NOT_FOUND
    rush(target: RoomPosition):void
    //rush(target:RoomPosition):CreepMoveReturnCode | ERR_NO_PATH | ERR_NOT_IN_RANGE | ERR_INVALID_TARGET
    findRoomPath(target:RoomPosition):string | null
    findFarPath(target:RoomPosition,range:number):string|null
    serializeFarPath(positions:RoomPosition[]):string
    goByCache(): CreepMoveReturnCode | ERR_NO_PATH | ERR_NOT_IN_RANGE | ERR_INVALID_TARGET
    farMoveTo(target:RoomPosition,range:number):CreepMoveReturnCode | ERR_NO_PATH | ERR_NOT_IN_RANGE | ERR_INVALID_TARGET
    remote(roomName:string):void
    tickCon():boolean
    tickExe():void
    tickSet(num:number):void

    /* 基本函数 */
    harvest_(resource_:Source) :void
    withdraw_(distination:Structure,rType:ResourceConstant) :void
    transfer_(distination:Structure,rType:ResourceConstant ) :void
    upgrade_():void
    build_(distination:ConstructionSite):void
    repair_(distination:Structure) : void
    GetBodyArray(part:BodyPartConstant[]):BodyPartConstant[]
    CheckBoost(part:BodyPartConstant[]):boolean
    
    // 基础功能函数
    harvest__(source_:Source):void
    transfer__(distination:Structure,rType:ResourceConstant) : void
    upgrade__():void
    build__(distination:ConstructionSite) : void
    repair__(distination:Structure) : void
    withdraw__(distination:Structure,rType:ResourceConstant) :void
    moveFlag(FlagName:string):void
    LastMisson(num:number):void

    /* 进阶函数 */
    // 采集者
    harvest_A1():void
    harvest_A2():void
    // 维护者
    vindicat_A1():void
    repair_A1():void
    repair_A2():void
    // 管理者
    manage_A1():void
    // 物流者
    transport_A1():void

    /* 功能函数 */
    carry_C1(source_:Tank,distination_:Tank,rType:ResourceConstant):void
    wipeResource(rType:ResourceConstant,stru:StructureStorage):void
    /* 任务2 */
    handMisson_():void
    Hand_LToS():void
    Hand_SToNT():void
    Hand_TToS():void
    Hand_IME():void
    Hand_RS():void
    Hand_RP():void
    Hand_OME():void
    Hand_SEF():void
    Hand_FTF():void
    Hand_AEAB():void
    /* war相关函数 */
    attack_(distination:Structure | Creep):void
    Invasion_C1(words?:string):void
}

interface CreepMemory {
    // 要开采的资源的id
    sourceId?: string
    // 临时目标id
    targetId?: string
    // tickcon
    tickcon?: number
    // 职责
    role: string
    // 职责下的分工
    Mrole?: string
    // 是否正在工作中
    working?: boolean
    // 所属房间
    belong?: string
    // 是否由统一框架进行运行？
    controlByFrame?: boolean
    // 内置移动缓存
    _move ?: object
    // 禁止被对穿
    standed?: boolean
    // 爬虫上一个tick所在的位置
    prePos?:string
    // 禁用自己对穿
    disableCross?:boolean
    // 用于爬虫远程寻路
    farMove?: {
        // 序列化之后的路径信息
        path?: string
        // 移动索引，标志 creep 现在走到的第几个位置
        index?: number
        // 上一个位置信息，形如"14/4"，用于在 creep.move 返回 OK 时检查有没有撞墙
        prePos?: string
        // 缓存路径的目标，该目标发生变化时刷新路径, 形如"14/4E14S1"
        targetPos?: string
    }
    // 爬虫房间内寻路
    roomMove?:{
        path?:string
        index?:number
        prePos?:string
        targetPos?:string
        // 撞停参数，如果撞停超过3tick，我们将认为异常，此时将会重新寻路
        stayTick?:number
        // 撞停白名单，处在撞停白名单的爬虫，即使撞停也不会触发重新寻路 todo:未完善相关逻辑
        whiteSheet?:string
    }
    // 是否已经组双人小的队？ 与谁组队？
    geez?:boolean
    geezTo?:string

    /* 当前在执行的任务 */
    inTask?:misson
    /* 与任务的绑定 为ID */
    bindTask?:string
    /* 用于存储必要ID信息，这将大大减少cpu消耗 */
    StorageId?:string
    TerminalId?:string
    TowerId?:string[]
    LinkId?:string[]
    /* 临时通用数 */
    num?:number
    boosted?:boolean
    disRoom?:string
    shard?:string   // 所属shard
}

/* 使用运输函数的structure */
type Tank = StructureStorage |
            StructureLink |
            StructureTerminal |
            StructureContainer |
            StructureTower |
            StructureLab |
            StructureFactory |
            StructureSpawn |
            StructurePowerSpawn |
            StructureExtension